package org.nlp2rdf.navigator.benchmark;

import org.aksw.commons.util.random.RandomUtils;

import java.util.Random;

/**
 * Created by Claus Stadler
 * Date: Oct 24, 2010
 * Time: 6:06:17 PM
 */
public class RandomNPickingStrategy<E>
    implements IPickingStrategy<E>
{
    private int n;
    private Random random;

    public RandomNPickingStrategy(int n, Random random)
    {
        this.n = n;
        this.random = random;
    }

    @Override
    public Sample<E> pick(Sample<E> source) {
        return Sample.create(
                RandomUtils.randomSampleSet(source.getPositives(), n, random),
                RandomUtils.randomSampleSet(source.getNegatives(), n, random));
    }
}
